package java6681.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Scanner;

/**
 * @author Junichiro
 * @description 测试
 * @date 2021-05-23 13:04
 **/

public class Dao6681 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("输入要删除的id：");
        int id = sc.nextInt();
        delete6681(id);
    }
    public static void delete6681(int id){
        Connection conn = null;
        PreparedStatement pstmt = null;
        try {
            conn = DBUtil6681.getConnection();
            String sql = "delete from xslist where id = ?";
            pstmt = conn.prepareStatement(sql);
            pstmt.setInt(1,id);
            int count = pstmt.executeUpdate();
            System.out.println(count);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }finally {
            DBUtil6681.close(pstmt,conn);
        }

    }
}
